<?php

/**
 * This file is part of the Framework03 PHP framework.
 * @author Walter Tamboer
 * @package Framework03
 */

/**
 * An insert statement that inserts data into the database table.
 */
class FW_Database_Statement_Insert extends FW_Database_Statement_Abstract
{
    /**
     * @var array An array with all the columns that should be used in the insert statement.
     */
    private $columns;

    /**
     * @var array An array with all the values that should be used in the insert statement.
     */
    private $values;

    /**
     * Initializes a new instance of this class.
     * @param FW_Database_Table $table The table to use in this statement.
     * @param array $data The optional data that should be inserted into the table.
     */
    public function __construct(FW_Database_Table $table, array $data = array())
    {
        $this->setTableName($table);
        
        $this->columns = array_keys($data);
        $this->values = array_values($data);
    }

    /**
     * Gets an array with all the columns used in this insert statement.
     * @return array
     */
    public function getColumnNames()
    {
        return $this->columns;
    }

    /**
     * Gets an array with all the values used in this insert statement.
     * @return array
     */
    public function getColumnValues()
    {
        return $this->values;
    }
}
